import 'package:event_listener/bean/EventNotifyBean.dart';
import 'package:event_listener/enums/EventNotify.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

import 'event_listener_method_channel.dart';

abstract class EventListenerPlatform extends PlatformInterface {
  /// Constructs a EventListenerPlatform.
  EventListenerPlatform() : super(token: _token);

  static final Object _token = Object();

  static EventListenerPlatform _instance = MethodChannelEventListener();

  /// The default instance of [EventListenerPlatform] to use.
  ///
  /// Defaults to [MethodChannelEventListener].
  static EventListenerPlatform get instance => _instance;

  /// Platform-specific implementations should set this with their own
  /// platform-specific class that extends [EventListenerPlatform] when
  /// they register themselves.
  static set instance(EventListenerPlatform instance) {
    PlatformInterface.verifyToken(instance, _token);
    _instance = instance;
  }

  Future<String?> getPlatformVersion() {
    throw UnimplementedError('platformVersion() has not been implemented.');
  }

  Future<void> startListening() {
    throw UnimplementedError('startListening() has not been implemented.');
  }

  /// Returns a Stream of EventNotify changes.
  Stream<EventNotifyBean> get onEventNotifyChanged {
    throw UnimplementedError(
        'get onEventNotifyChanged has not been implemented.');
  }
}
